<!-- subpkg_medicine/pay_result/index.vue -->
<script lang="ts" setup>
	// import { ref } from 'vue'
	// import { getMedicalOrderDetail } from '@/apis/order'
	// import { MedicalOrderDetail } from '@/types/order.d.ts'

	import { useMedic } from '@/hooks/index'

	// 解析 url 参数
	const props = defineProps<{ orderId: string }>()
	// 状态变量
	// const orderInfo = ref({} as MedicalOrderDetail)
	// const getData = async () => {
	// 	const res = await getMedicalOrderDetail(props.orderId)
	// 	console.log(res)
	// 	orderInfo.value = res
	// }
	// getData()

	const { orderInfo } = useMedic(props.orderId)
</script>
<template>
	<view class="pay-result-page">
		<view v-if="orderInfo.status === 12 || orderInfo.status === 11" class="result">
			<uni-icons size="70" color="#20c6b2" type="checkbox-filled" />
			<view class="amount">¥ {{ orderInfo.payment }}</view>
			<view class="label">支付成功</view>
			<view class="tips">订单支付成功，{{ orderInfo.statusValue }}~</view>
		</view>
		<view v-else-if="orderInfo.status === 10" class="result">
			<uni-icons size="70" color="#20c6b2" type="closeempty" />
			<view class="amount">¥ {{ orderInfo.payment }}</view>
			<view class="label">支付失败</view>
			<view class="tips">订单支付失败，请回订单中心重新支付~</view>
		</view>

		<view class="buttons">
			<navigator
				hover-class="none"
				:url="`/subpkg_medicine/order_detail/order_detail?id=${orderInfo.id}`"
				class="uni-button"
			>
				查看订单
			</navigator>
			<!-- 会跳的时候 参数的名字 需要和 问诊室原本的 id 同名 orderId -->
			<navigator
				hover-class="none"
				:url="`/subpkg_consult/room/room?orderId=${orderInfo.roomId}`"
				open-type="redirect"
				class="uni-button plain"
			>
				返回诊室
			</navigator>
		</view>
	</view>
</template>

<style lang="scss">
	@import './index.scss';
</style>